// Copyright (c) [2019] [huazhonghua]
// [理解] is licensed under the Mulan PSL v1.
// You can use this software according to the terms and conditions of the Mulan PSL v1.
// You may obtain a copy of Mulan PSL v1 at:
//     http://license.coscl.org.cn/MulanPSL
// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
// PURPOSE.
// See the Mulan PSL v1 for more details.

#include <stdio.h>
#include <locale.h>

#include "structure.h"
#include "worker.h"
#include "parsing.h"
#include "initialization.h"
#include "data_server.h"

int main() {
	setlocale(LC_ALL, "en_US.UTF-8");

	Node* all = build_basic();

	start_data_server(all);
	setup_workers(all, 1);

	FILE* fd = fopen("fibonacci_zh-cn.txt", "r");
	ParseInfo info;
	info.file = fd;
	info.context_stack = create_context_stack(all);
	parse(all, &info);
	fclose(fd);

	getchar();

	stop_data_server(all);
	teardown_workers(all);

	return 0;
}
